<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>查看便签 - 便签系统</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.1/font/bootstrap-icons.css" rel="stylesheet">
    <link href="/css/custom.css" rel="stylesheet">
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark">
        <div class="container">
            <a class="navbar-brand" href="/memo/list">
                <i class="bi bi-sticky me-2"></i>便签系统
            </a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav me-auto">
                    <li class="nav-item">
                        <a class="nav-link" href="/memo/list">
                            <i class="bi bi-collection me-1"></i>我的便签
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/memo/add">
                            <i class="bi bi-plus-circle me-1"></i>添加便签
                        </a>
                    </li>
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" id="categoriesDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                            <i class="bi bi-tag me-1"></i>分类管理
                        </a>
                        <ul class="dropdown-menu" aria-labelledby="categoriesDropdown">
                            <li><a class="dropdown-item" href="/category/list"><i class="bi bi-list-ul me-1"></i>查看分类</a></li>
                            <li><a class="dropdown-item" href="/category/add"><i class="bi bi-plus-lg me-1"></i>添加分类</a></li>
                        </ul>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/memo/recycle-bin">
                            <i class="bi bi-trash me-1"></i>回收站
                        </a>
                    </li>
                </ul>
                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link" href="/logout">
                            <i class="bi bi-box-arrow-right me-1"></i>退出登录
                        </a>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

    <div class="container mt-4">
        <div class="d-flex justify-content-between align-items-center mb-4">
            <div>
                <h2>
                    <i class="bi bi-sticky me-2"></i>
                    <span th:text="${memo.title}">便签标题</span>
                </h2>
                <div th:if="${memo.category != null}" class="mt-2">
                    <span class="badge" th:style="'background-color: ' + ${memo.category.color} + ';'">
                        <i class="bi bi-tag me-1"></i>
                        <span th:text="${memo.category.name}">分类名称</span>
                    </span>
                </div>
            </div>
            <div>
                <a th:href="@{/memo/edit/{id}(id=${memo.id})}" class="btn btn-secondary">
                    <i class="bi bi-pencil me-1"></i>编辑
                </a>
                <a th:href="@{/memo/move-to-trash/{id}(id=${memo.id})}" class="btn btn-danger ms-2" 
                   onclick="return confirm('确定要将这条便签移至回收站吗？')">
                    <i class="bi bi-trash me-1"></i>移至回收站
                </a>
            </div>
        </div>
        
        <div class="card memo-view-card fade-in">
            <div class="card-body">
                <p class="card-text memo-content" th:text="${memo.content}">便签内容</p>
            </div>
            <div class="card-footer text-muted">
                <div class="d-flex justify-content-between memo-metadata">
                    <span>
                        <i class="bi bi-calendar-plus me-1"></i>创建时间：
                        <span th:text="${#dates.format(memo.createTime, 'yyyy-MM-dd HH:mm')}">创建时间</span>
                    </span>
                    <span>
                        <i class="bi bi-calendar-check me-1"></i>更新时间：
                        <span th:text="${#dates.format(memo.updateTime, 'yyyy-MM-dd HH:mm')}">更新时间</span>
                    </span>
                </div>
            </div>
        </div>
        
        <div class="mt-4">
            <a href="/memo/list" class="btn btn-primary">
                <i class="bi bi-arrow-left me-1"></i>返回列表
            </a>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html> 